const axios = require('axios')
// 假设接口定义在 spiderOption.ts 文件中
// const SpiderOption = require('./interfaces/SpiderOption')
class Spider {
  options
  constructor(options) {
    this.options = options
  }
  start () {
    return axios({
      url: this.options.url,
      headers: this.options.headers,
      data: this.options.data,
      method: this.options.method,
    }).then((response) => {
      return response.data // 直接返回响应数据
    }).catch((error) => {
      throw error // 抛出错误以便外部捕获
    })
  }
}
module.exports = Spider
